package com.ruoyi.web.controller.auto;

import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.domain.AutoConfig;
import com.ruoyi.domain.AutoVueConfig;
import com.ruoyi.service.AutoConfigService;
import com.ruoyi.service.AutoVueConfigService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.jws.Oneway;
import java.util.List;

/**
 * lhp
 * 2024/8/26
 */
@RestController
@RequestMapping("/auto")
public class AutoPublistController extends BaseController {
    @Autowired
    private AutoConfigService autoConfigService;
    @Autowired
    private AutoVueConfigService vueConfigService;

    @Log(title = "打包", businessType = BusinessType.OTHER)
    @RequestMapping( "/topackage")
    public AjaxResult topackage(@RequestBody AutoConfig autoConfig)
    {
        AjaxResult ajaxResult=autoConfigService.topackage(autoConfig);
        return ajaxResult;
    }

    @Log(title = "上传", businessType = BusinessType.OTHER)
    @PreAuthorize("@ss.hasPermi('lims:waitflow:expection')")
    @RequestMapping( "/toupload")
    public AjaxResult toupload(@RequestBody AutoConfig autoConfig)
    {
        AjaxResult ajaxResult=autoConfigService.toupload(autoConfig);
        return ajaxResult;
    }
    @Log(title = "启动jar", businessType = BusinessType.OTHER)
    @PreAuthorize("@ss.hasPermi('lims:waitflow:expection')")
    @RequestMapping( "/restart")
    public AjaxResult restart(@RequestBody AutoConfig autoConfig)
    {
        AjaxResult ajaxResult=autoConfigService.restart(autoConfig);
        return ajaxResult;
    }

    @Log(title = "新增", businessType = BusinessType.OTHER)
    @RequestMapping( "/add")
    public AjaxResult add(@RequestBody AutoConfig autoConfig)
    {
        AjaxResult ajaxResult=autoConfigService.add(autoConfig);
        return ajaxResult;
    }
    @Log(title = "删除", businessType = BusinessType.OTHER)
    @RequestMapping( "/deleteDate")
    public AjaxResult deleteDate(@RequestBody AutoConfig autoConfig)
    {
        AjaxResult ajaxResult=autoConfigService.deleteDate(autoConfig);
        return ajaxResult;
    }
    @Log(title = "查询", businessType = BusinessType.OTHER)
    @RequestMapping( "/list")
    public TableDataInfo getlist(AutoConfig autoConfig)
    {
        startPage();
        List<AutoConfig> list=autoConfigService.getlist(autoConfig);
        return getDataTable(list);
    }

    @Log(title = "查询", businessType = BusinessType.OTHER)
    @RequestMapping( "/vuelist")
    public TableDataInfo vuelist(AutoVueConfig autoVueConfig)
    {
        startPage();
        List<AutoVueConfig> list=vueConfigService.getlist(autoVueConfig);
        return getDataTable(list);
    }
    @Log(title = "新增", businessType = BusinessType.OTHER)
    @RequestMapping( "/vueadd")
    public AjaxResult vueadd(@RequestBody AutoVueConfig autoVueConfig)
    {
        AjaxResult ajaxResult=vueConfigService.add(autoVueConfig);
        return ajaxResult;
    }

    @Log(title = "删除", businessType = BusinessType.OTHER)
    @RequestMapping( "/vuedeleteDate")
    public AjaxResult vuedeleteDate(@RequestBody AutoVueConfig autoVueConfig)
    {
        AjaxResult ajaxResult=vueConfigService.deleteDate(autoVueConfig);
        return ajaxResult;
    }

    @Log(title = "构建", businessType = BusinessType.OTHER)
    @RequestMapping( "/tobuild")
    public AjaxResult tobuild(@RequestBody AutoVueConfig autoVueConfig)
    {
        AjaxResult ajaxResult=vueConfigService.tobuild(autoVueConfig);
        return ajaxResult;
    }

}
